# DocType Mapper, Purchase Order-Payable Voucher
[

	# These values are common in all dictionaries
	{
		'creation': '2010-08-08 17:09:35',
		'docstatus': 0,
		'modified': '2011-10-12 12:10:15',
		'modified_by': 'Administrator',
		'owner': 'Administrator'
	},

	# These values are common for all Table Mapper Detail
	{
		'doctype': 'Table Mapper Detail',
		'name': '__common__',
		'parent': 'Purchase Order-Payable Voucher',
		'parentfield': 'table_mapper_details',
		'parenttype': 'DocType Mapper'
	},

	# These values are common for all Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'name': '__common__',
		'parent': 'Purchase Order-Payable Voucher',
		'parentfield': 'field_mapper_details',
		'parenttype': 'DocType Mapper'
	},

	# These values are common for all DocType Mapper
	{
		'doctype': u'DocType Mapper',
		'from_doctype': 'Purchase Order',
		'module': 'Accounts',
		'name': '__common__',
		'ref_doc_submitted': 1,
		'to_doctype': 'Payable Voucher'
	},

	# DocType Mapper, Purchase Order-Payable Voucher
	{
		'doctype': u'DocType Mapper',
		'name': 'Purchase Order-Payable Voucher'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'eval: flt(obj.qty) - flt(obj.billed_qty)',
		'map': 'Yes',
		'match_id': 1,
		'to_field': 'qty'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'purchase_rate',
		'map': 'Yes',
		'match_id': 1,
		'to_field': 'rate'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.purchase_rate)',
		'map': 'Yes',
		'match_id': 1,
		'to_field': 'amount'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'eval: (flt(obj.qty) - flt(obj.billed_qty)) * flt(obj.import_rate)',
		'map': 'Yes',
		'match_id': 1,
		'to_field': 'import_amount'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'parent',
		'map': 'Yes',
		'match_id': 1,
		'to_field': 'purchase_order'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'name',
		'map': 'Yes',
		'match_id': 1,
		'to_field': 'po_detail'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'naming_series',
		'map': 'No',
		'match_id': 0,
		'to_field': 'naming_series'
	},

	# Field Mapper Detail
	{
		'doctype': 'Field Mapper Detail',
		'from_field': 'total_tax',
		'map': 'Yes',
		'match_id': 0,
		'to_field': 'total_tax'
	},

	# Table Mapper Detail
	{
		'doctype': 'Table Mapper Detail',
		'from_table': 'Purchase Order',
		'match_id': 0,
		'to_table': 'Payable Voucher',
		'validation_logic': 'docstatus =1'
	},

	# Table Mapper Detail
	{
		'doctype': 'Table Mapper Detail',
		'from_field': 'po_details',
		'from_table': 'PO Detail',
		'match_id': 1,
		'to_field': 'entries',
		'to_table': 'PV Detail',
		'validation_logic': 'ifnull(billed_qty,0)  < qty and docstatus = 1'
	},

	# Table Mapper Detail
	{
		'doctype': 'Table Mapper Detail',
		'from_field': 'purchase_tax_details',
		'from_table': 'Purchase Tax Detail',
		'match_id': 2,
		'to_field': 'purchase_tax_details',
		'to_table': 'Purchase Tax Detail',
		'validation_logic': 'docstatus =1'
	}
]